package com.execjar;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.junit.Test;

import java.time.LocalTime;
import java.util.ArrayList;

@Slf4j(topic = "d")
public class D {

    @Test
    public void d() {
        log.info("地磅");
        DateTime now = DateTime.now();

        ArrayList<Integer> integers = Lists.newArrayList(0, 0, 0, 0);
        System.out.println(StringUtils.join(integers, ","));


        System.out.println(now.toLocalDate().withDayOfMonth(1));
        LocalDateTime today = LocalDateTime.now();


        DateTime currentDateTime = new DateTime();// 今天的零点
        DateTime dateTime = currentDateTime.withMillisOfDay(0);//
        // 昨天的零点
        currentDateTime.withMillisOfDay(0).plusDays(-1);//
        // 明天的零点
        currentDateTime.withMillisOfDay(0).plusDays(1);//
        // 这一年最后一天0点
        new DateTime().dayOfYear().withMaximumValue().withMillisOfDay(0);//
        // 这一年第一天0点
        new DateTime().dayOfYear().withMinimumValue().withMillisOfDay(0);//
        // 这个月最后一天0点
        new DateTime().dayOfMonth().withMaximumValue().withMillisOfDay(0);
        // 这个月月初0点
        new DateTime().dayOfMonth().withMinimumValue().withMillisOfDay(0);

        System.out.println(dateTime);
        System.out.println(dateTime.minusMillis(1));


        LocalTime now1 = LocalTime.now();
        System.out.println(LocalTime.MIDNIGHT);
        System.out.println(LocalTime.MIN);
        System.out.println(LocalTime.MAX);

        System.out.println(org.joda.time.LocalTime.now().withMillisOfDay(86399999));
    }
}
